<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.global.js"></script>
</head>

<body>

    <div id="app">
        <button-counter></button-counter>

        <button-counter></button-counter>
        <button-counter></button-counter>
        <button-counter></button-counter>
    </div>

    <script>
        // 创建一个Vue 应用
        const app = Vue.createApp({})

        // 定义一个名为 button-counter 的新全局组件
        app.component('button-counter', {
            data() {
                return {
                    count: 0
                }
            },
            template: `
            <button @click="count++">
            You clicked me {{ count }} times.
            </button>`
        })

        app.mount("#app")
    </script>

</body>

</html>